﻿<controls:MetroWindow x:Class="MaxStoreErp.Shell.MetroShell.MetroShellView"
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
                      xmlns:converters="clr-namespace:MaxStoreErp.Core.Converters;assembly=MaxStoreErp.Core"
                      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                      xmlns:infrastructure="clr-namespace:MaxStoreErp.Core.Infrastructure;assembly=MaxStoreErp.Core"
                      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                      xmlns:metroShell="clr-namespace:MaxStoreErp.Shell.MetroShell"
                      xmlns:regions="http://www.codeplex.com/CompositeWPF"
                      Title="{Binding Header}"
                      ShowTitleBar="True"
                      WindowState="Maximized"
                      d:DataContext="{d:DesignInstance metroShell:MetroShellViewModel}"
                      d:DesignHeight="300"
                      d:DesignWidth="300"
                      mc:Ignorable="d">
    <controls:MetroWindow.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../Resources/Images.xaml" />
            </ResourceDictionary.MergedDictionaries>
            <converters:NullToVisibilityConverter x:Key="NullToVisibilityConverter" />
        </ResourceDictionary>
    </controls:MetroWindow.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <ToolBar Name="MainToolBar"
                 VerticalAlignment="Top"
                 IsEnabled="{Binding IsToolbarEnabled}"
                 ItemsSource="{Binding ToolbarItems,
                                       Mode=TwoWay}">
            <Button Width="44"
                    Height="44"
                    BorderThickness="0"
                    Command="{Binding ShowNavigationWindowCommand}"
                    Style="{DynamicResource MetroCircleButtonStyle}"
                    Visibility="{Binding ShowNavigationWindowCommand,
                                         Converter={StaticResource NullToVisibilityConverter},
                                         ConverterParameter=inverse}">
                <Path Width="32"
                      Height="32"
                      Data="{StaticResource HomeIcon}"
                      Fill="{DynamicResource BlackBrush}"
                      Stretch="Uniform" />
            </Button>
            <Button Width="44"
                    Height="44"
                    BorderThickness="0"
                    Command="{Binding LoginUserCommand}"
                    Style="{DynamicResource MetroCircleButtonStyle}"
                    Visibility="{Binding LoginUserCommand,
                                         Converter={StaticResource NullToVisibilityConverter},
                                         ConverterParameter=inverse}">
                <Path Width="32"
                      Height="32"
                      Data="{StaticResource LoginIcon}"
                      Fill="{DynamicResource BlackBrush}"
                      Stretch="Uniform" />
            </Button>
            <Button Width="44"
                    Height="44"
                    BorderThickness="0"
                    Command="{Binding Back}"
                    Style="{DynamicResource MetroCircleButtonStyle}"
                    Visibility="{Binding Back,
                                         Converter={StaticResource NullToVisibilityConverter},
                                         ConverterParameter=inverse}">
                <Path Width="32"
                      Height="32"
                      Data="{StaticResource BackIcon}"
                      Fill="{DynamicResource BlackBrush}"
                      Stretch="Uniform" />
            </Button>
        </ToolBar>
        <ContentControl Grid.Row="1" regions:RegionManager.RegionName="{x:Static infrastructure:PrismRegionNames.MainWindowRegion}" />
        <StatusBar Name="MainStatusBar" Grid.Row="2">
            <TextBlock Visibility="{Binding CurrentUser, Converter={StaticResource NullToVisibilityConverter}, ConverterParameter=inverse}">
                <Run Text="Пользователь:" />
                <Run Text="{Binding CurrentUser.DisplayName}" />
            </TextBlock>
        </StatusBar>
    </Grid>

</controls:MetroWindow>
